package com.bjsxt.controller;

import java.security.Principal;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户接口
 * 
 * @author michael
 * @date 2021/06/23
 * @version 1.0
 * @Copyright Copyright (c) 2021, michael.xie@adsnova.cn All Rights Reserved. 
 */
@RestController
public class UserInfoController {
    
    /**
     * 当前登录的用户对象
     */
    @GetMapping("/user/info")
    public Principal userInfo(Principal principal) {
        
        // 使用ThreadLocal来实现的   authentication == principal
        // Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        
        return principal;
    }

}
